package com.yukexx.common.utils;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.ExcessiveAttemptsException;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheManager;

import java.util.concurrent.atomic.AtomicInteger;


/**
 * <p>Title: RetryLimitHashedCredentialsMatcher.java</p>
 * <p>Description: 登录凭证限制适配器</p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <p>Company: www.yukexx.com</p>
 * @author 王钰鹏
 * @date 2017年2月27日上午11:36:18
 * @version 1.0
 */
public class RetryLimitHashedCredentialsMatcher extends HashedCredentialsMatcher {
	
    private Cache<String, AtomicInteger> passwordRetryCache;

    public RetryLimitHashedCredentialsMatcher(CacheManager cacheManager) {
        passwordRetryCache = cacheManager.getCache("passwordRetryCache");
    }

    @Override
    public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
       

        boolean matches = super.doCredentialsMatch(token, info);
        
        return matches;
    }
}
